package com.example.neusoft215gdh.androidpro_21.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import com.example.neusoft215gdh.androidpro_21.Adapter.ClubDetailVideoAadapter;
import com.example.neusoft215gdh.androidpro_21.Common.utilMeth;
import com.example.neusoft215gdh.androidpro_21.JavaBean.ClubCourse;
import com.example.neusoft215gdh.androidpro_21.JavaBean.ClubDetail;
import com.example.neusoft215gdh.androidpro_21.JavaBean.ClubList;
import com.example.neusoft215gdh.androidpro_21.Listener.ClubListener;
import com.example.neusoft215gdh.androidpro_21.R;

import java.util.List;

/**
 * Created by hp-pc on 2017/10/16.
 */
public class ClubDetailActivity extends AppCompatActivity implements utilMeth, ClubListener ,View.OnClickListener{

    RecyclerView recyclerView;
    Button club_intro;
    Button club_class;
    Button club_video;
    Intent intent;
    String id;
    List<ClubDetail> clubDetails;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.club_detail);
        initViews();
        intent=getIntent();
        id=intent.getStringExtra("club_id");
        club_intro.setOnClickListener(this);
        club_class.setOnClickListener(this);
        club_video.setOnClickListener(this);
    }

    @Override
    public void initViews() {
        recyclerView= (RecyclerView) findViewById(R.id.re_club);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));//注意这句话一定要加
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        club_intro= (Button) findViewById(R.id.club_intro);
        club_class= (Button) findViewById(R.id.club_class);
        club_video= (Button) findViewById(R.id.club_video);
    }

    @Override
    public void onResponse(List<ClubList> bean) {

    }

    @Override
    public void onResponseClubDetailVideo(List<ClubDetail> bean) {
        clubDetails=bean;
        recyclerView.setAdapter(new ClubDetailVideoAadapter(this,clubDetails));
    }

    @Override
    public void onResponseClubDetailjianjie(ClubDetail bean) {

    }


    @Override
    public void onResponseClubDetailCourse(ClubCourse bean) {

    }

    @Override
    public void onFail(String msg) {

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.club_intro:
                Intent intent1=new Intent(this,ClubjianjieActivity.class);
                intent1.putExtra("clubid",id);
                startActivity(intent1);
              break;
            case R.id.club_class:
                Intent intent2=new Intent(this,ClubCourseActivity.class);
                intent2.putExtra("clubid",id);
                startActivity(intent2);
                break;
            case R.id.club_video:
                Intent intent3=new Intent(this,ClubVideoActivity.class);
                intent3.putExtra("clubid",id);
                startActivity(intent3);
                break;
        }
    }
}
